
package com.xuebang.admin.service;

import java.util.List;

import javax.inject.Inject;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.xuebang.admin.entity.Friends;
import com.xuebang.admin.mapper.FriendsMapper;

@Service
public class FriendsService {

	@Inject
	FriendsMapper friendsMapper;

	/**
	 * 展示所有的友情连接
	 */
	@Transactional(readOnly = true)
	public List<Friends> showFriends() {

		return friendsMapper.loadFriends();
	}
	
	/**
	 * 分类展示
	 */
	@Transactional(readOnly = true)
	public List<Friends> loadFriendsbyIfusing(int ifusing) {
		return friendsMapper.loadFriendsbyIfusing(ifusing);
	}

	/**
	 * load
	 */
	@Transactional(readOnly = true)
	public Friends loadFriend(Integer friendsId) {

		return friendsMapper.loadFriend(friendsId);
	}

	/**
	 * 增加
	 */
	@Transactional(rollbackFor = Exception.class)
	public void addFriends(Friends friends) {
		friendsMapper.addFriends(friends);
	}
	/**
	 * 更新
	 */
	@Transactional(rollbackFor = Exception.class)
	public void updateFriends(Friends friends) {
			friendsMapper.updateFriends(friends);
	}
	

	/**
	 * 删除
	 * 
	 * @param menuColumn
	 */
	@Transactional(rollbackFor = Exception.class)
	public void deleteFriends(String strColumnIDs) {
		friendsMapper.deleteFriends(strColumnIDs.split(","));
	}
	/**
	 * 查询
	 * 
	 * @param 
	 */
	@Transactional(rollbackFor = Exception.class)
	public List<Friends> findFriends(String strColumnIDs) {
		return friendsMapper.findFriends(strColumnIDs.split(","));
	}
	/**
	 * 得到的数目
	 * 
	 * @param type
	 *            类型
	 */
	@Transactional(readOnly = true)
	public Integer getFriendsNum(Integer ifusing) {
		return friendsMapper.getLinksNum(ifusing);
	}


}
